using UnityEngine;
using System.Collections;

public class AtlasManager : MonoBehaviour 
{
	public static Texture2D globalTexture;
	public static Rect[] rects;
	private Texture2D[] textures;
	public static Material globalMaterial;
	int t = 0;
	int l = 1;
	
	
	public void Awake()
	{
		string[] files = new string[] {"Bg_Menu","Bloco","Bullet","Coin","Meteor","Manha","Tarde","Noite","Comecar_n","Comecar_o","Creditos_n","Creditos_o","Historia_n","Historia_o","TelaMedalhas_B","TelaMedalhas_P","TelaMedalhas_O","Fechar_n","Fechar_o","TelaPeriodo","TelaSinopse","TelaCreditos","Manha_o","Voltar_n","Voltar_o","Fundo_Game","Cartela"};
		
		textures = new Texture2D[98];
		
		for(var j = 0; j < 71 ; j++)
		{
			this.textures[j] = (Texture2D)Resources.Load("Textures/" + "Riovaldo_RunCycle (" + l + ")");
			l++;
		}
		
		for(var i = 71; i < 98 ; i++)
		{
			this.textures[i] = (Texture2D)Resources.Load("Textures/" + files[t]);
			t++;
		}
        

		
		
		
		globalTexture = AtlasTextures.Create(this.textures, out rects);
				
		globalMaterial = new Material((Shader)Resources.Load("Shader/Basic2D"));
		globalMaterial.mainTexture = globalTexture;
	}
}
